# -*- coding:utf-8 -*-
__author__ = "Jim"
"""
Create by Jim on2019/01/08
"""

from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_wtf import CSRFProtect
from flask_session import Session
from redis import StrictRedis

db = SQLAlchemy()
redis_store = None


def create_app():
    app = Flask(__name__)

    CSRFProtect(app)
    Session(app)
    app.config.from_object('info.settings')
    register_blueprint(app)
    redis_store = StrictRedis(host=app.config['REDIS_HOST'], port=app.config['REDIS_PORT'],
                              password=app.config['REDIS_PASSWORD'])
    from info import models
    return app


# 注册蓝图
def register_blueprint(app):
    pass